<?php $this->load->view('/user/menu_contributor.php'); ?>

<div class="page_inner">

	<?php echo form_open($this->curl . '/edit/' . $this->validation->id, 'id="myform" name="myform" autocomplete="off"')?>
	<?php echo form_hidden('id', $this->validation->id)?>
	<br />
	<table class="nostyle" width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td>
			<?php echo $this->validation->error_string?>
			<table class="nostyle forma" width="100%" border="0" cellpadding="3" cellspacing="0">
			<tr>
				<th><?php $this->load->view('_elements/obligatory');?><?php echo $this->credit_cards_model->fields['card_type']?></th>
				<td>
					<div class="input_300">
						<?php echo form_dropdown('card_type', $this->config->item('credit_cards'), array($this->validation->card_type), null, TRUE)?>
					</div>
				</td>
			</tr>
			<tr>
				<th></th>
				<td>
					<div style="padding:1px 0 2px 0"><a class="help" target="_blank" href="/site/content/help"><?php echo T_('Don\'t see your card type?'); ?></a></div>
				</td>
			</tr>
			<tr>
				<th><?php $this->load->view('_elements/obligatory');?><?php echo $this->credit_cards_model->fields['card_number']?></th>
				<td><div class="input_300"><?php echo form_input('card_number', $this->validation->card_number, 'class="input-text"')?></div></td>
			</tr>
			<tr>
				<th><?php $this->load->view('_elements/obligatory');?><?php echo T_('Expiration Date'); ?></th>
				<td>
					<div class="input_120" style="float: left;margin-right:10px">
						<?php echo form_dropdown('month_expired', $this->config->item('months'), array($this->validation->month_expired), null, FALSE)?>
					</div>
					<div class="input_80" style="float: left">
						<?php 
							$year_expired[0] = 'Year';
							$y = date('Y');
							for($i=$y+10; $i>=$y; $i--)
							{
								$year_expired[$i] = $i;
							}
						?>
						<?php echo form_dropdown('year_expired', $year_expired, array($this->validation->year_expired), null, FALSE)?>
					</div>
				</td>
			</tr>
			<tr>
				<th><?php $this->load->view('_elements/obligatory');?><?php echo $this->credit_cards_model->fields['card_id_number']?></th>
				<td>
					<div class="input_120" style="float: left;margin-right:10px"><?php echo form_input('card_id_number', $this->validation->card_id_number, 'class="input-text"')?></div>
					<div style="float: left;padding-top:4px"><a class="help" target="_blank" href="/site/content/help"><?php echo T_('What\'s this?'); ?></a></div>
				</td>
			</tr>
			<tr>
				<th></th>
				<td><strong><?php echo T_('Cardholder name'); ?></strong> <?php echo T_('(as it appears on the card)'); ?></td>
			</tr>
			<tr>
				<th><?php $this->load->view('_elements/obligatory');?><?php echo $this->credit_cards_model->fields['first_name'];?></th>
				<td><div class="input_300"><?php echo form_input('first_name', $this->validation->first_name, 'class="input-text"')?></div></td>
			</tr>
			<tr>
				<th><?php $this->load->view('_elements/obligatory');?><?php echo $this->credit_cards_model->fields['last_name'];?></th>
				<td><div class="input_300"><?php echo form_input('last_name', $this->validation->last_name, 'class="input-text"')?></div></td>
			</tr>
			<tr>
				<th><?php echo $this->credit_cards_model->fields['is_default_card']?></th>
				<td><?php echo form_checkbox('is_default_card', 1, ($this->validation->is_default_card) ? TRUE : FALSE, 'class="checkbox"')?></td>
			</tr>
			<tr>
				<td colspan="2">&nbsp;</td>
			</tr>
			<tr>
				<td></td>
				<td>			
					<input name="edit" type="submit" class="btn btn_save" id="submit" value="<?php echo T_('Submit')?>" />
					<input name="reset" type="reset" class="btn btn_clear" id="reset" value="<?php echo T_('Reset')?>" onclick="$('#create_form input[type=text]').val('');" />
					<input name="delete" type="button" class="btn btn_delete" id="delete" value="<?php echo T_('Delete')?>" onclick="if (confirm('<?php echo T_('Are you sure you want to delete this Credit Card?')?>')) location='/site/credit_cards/delete/<?php echo $this->validation->id; ?>/<?php echo $id_user?>/';return false;" />
				</td>
			</tr>
			</table>
		</td>
	</tr>
	</table>
	
	<?php echo form_close()?>
	
</div>